<template>
  <div class="app-container" v-loading="pageLoading">
    <z-table :list="list" :tableProps="tableProps" :columns="columns">
    </z-table>
  </div>
</template>

<script>
import commonMixin from '@/views/_common/mixin'

export default {
  name: 'tab4',
  mixins: [commonMixin],
  components: {},
  props: {
    basicInfoShow: {
      type: Boolean,
      default: true,
    },
    deviceId: {
      type: String,
      default: '',
    },
  },
  data() {
    return {
      api: this.$api.TpmEquipmentPart,

      // 清单
      name: '备件清单',
      tableProps: {
        border: true,
        opsColWith: 161,
        hideOperations: false,
      },

      columns: [
        { title: '备件名称', key: 'name' },
        { title: '数量', key: 'qty' },
        { title: '修改人', key: 'modify_user', width: 100 },
        { title: '最后修改时间', key: 'modify_time', width: 100 },
      ],
      postForList: true,
    }
  },
  computed: {},
  watch: {
    basicInfoShow: {
      immediate: true,
      handler(val, old) {
        if (!val) {
          this.tableProps = {
            border: true,
            opsColWith: 160,
            fixed: false,
            highlightCurrentRow: true,
            hideOperations: true,
          }
          this.rowClick(this.deviceId)
        }
      },
    },
  },
  created() {},
  mounted() {},
  methods: {
    rowClick(id) {
      this.query.machine_id = id
      this.research()
    },
  },
}
</script>

<style lang="scss" scoped></style>